package Searcher;

import java.util.ArrayList;

public class SearchResults {

	private int matches;
	private String[] displayResults;
	private ArrayList<ArrayList<String>> topScored;

	public SearchResults(int matches, String[] displayResults, ArrayList<ArrayList<String>> topScored) {
		this.matches = matches;
		this.displayResults = displayResults;
		this.topScored = topScored;
	}

	/**
	 * @return the displayResults
	 */
	public final String[] getDisplayResults() {
		return displayResults;
	}



	/**
	 * @return the topScored
	 */
	public final ArrayList<ArrayList<String>> getTopScored() {
		return topScored;
	}

	/**
	 * Returns a cell of topScored as an array of strings
	 * @param id
	 * @return
	 */
	public final String[] getTopScoredArray(int id) {
		String[] out = new String[topScored.get(id).size()];

		System.out.println("AL: " + topScored.get(id).size() + ", A: " + out.length);
		for(int i = 0 ; i < topScored.get(id).size() ; i++) {
			out[i] = topScored.get(id).get(i);
			//System.out.println(out[i] + " --- " + topScored.get(id).get(i));
		}
		return out;
	}

	/**
	 * @return the matches
	 */
	public final int getMatches() {
		return matches;
	}

	public String topScoredWordsToString(int index) {
		String tswString = "";
		ArrayList<String> topScoredOfThisTerm = topScored.get(index);
		for (int i = 0 ; i < topScoredOfThisTerm.size() ; i++) {
			tswString += topScoredOfThisTerm.get(i);
			if(i < topScoredOfThisTerm.size()-1)
				tswString +=  " ";
		}
		return tswString;
	}





}
